home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 …ember: Reference Library / Dev.CD Dec 94.toast / Periodicals / develop / develop Issue 15 / develop 15 code / Floating Windows / Sample Source / fileMenuRoutines.c < prev    next >
Encoding:
Text File  |  1994-10-13  |  1.5 KB  |  77 lines  |  [TEXT/MMCC]

  1. // If the interfaces aren't included yet, do the standard includes. Otherwise, precompiled headers
  2. // have been loaded already, thank you very much
  3. #ifndef __TYPES__
  4.     #include <Types.h>
  5.     #include <AppleEvents.h>
  6.     #include <Desk.h>
  7.     #include <Dialogs.h>
  8.     #include <Editions.h>
  9.     #include <Events.h>
  10.     #include <Menus.h>
  11.     #include <SegLoad.h>
  12.     #include <StandardFile.h>
  13.     #include <TextUtils.h>
  14.     #include <ToolUtils.h>
  15.     #include <Windows.h>
  16. #endif
  17.  
  18. #include "fileMenuRoutines.h"
  19. #include "WindowExtensions.h"
  20.  
  21.     /* Temporary defines */
  22.     
  23. #define    rAlertStringsID    129
  24. #define    kOpenFileString    1
  25. #define    kPrintFileString    2
  26.  
  27.     /*    Private prototypes */
  28.     
  29. void    AlertUser(short alertStringID, Str255 fileName);
  30.     
  31. void    AlertUser(short    alertStringID, Str255 fileName)
  32. {
  33.     short    alrtItem;
  34.     Str255    errString;
  35.     
  36.     GetIndString(errString, rAlertStringsID, alertStringID);
  37.     ParamText(errString, fileName, nil, nil);
  38.     alrtItem = Alert(129, nil);
  39. }
  40.  
  41. void    GetFileToOpen()
  42.  
  43. /*    Have user choose a file to open from StandardGetFile */
  44.  
  45. {
  46.     StandardFileReply    fileInfo;
  47.     SFTypeList            typesToShow;
  48.     
  49.     typesToShow[0] = '****';
  50.     
  51.     DeactivateFloatersAndFirstDocumentWindow();
  52.     StandardGetFile(nil, -1, typesToShow, &fileInfo);
  53.     
  54.     if (fileInfo.sfGood)
  55.         DoOpenFile(&(fileInfo.sfFile));
  56.     
  57.     ActivateFloatersAndFirstDocumentWindow();
  58. }
  59.  
  60. void    DoOpenFile(FSSpec *fileToOpen)
  61.  
  62. {
  63.     AlertUser(kOpenFileString, fileToOpen->name);
  64. }
  65.  
  66. void    DoPrint()
  67.  
  68. {
  69. }
  70.  
  71. void    DoPrintFile(FSSpec *fileToPrint)
  72.  
  73. {
  74.     AlertUser(kPrintFileString, fileToPrint->name);
  75. }
  76.  
  77.